<template>
  <a-card :bordered="false">
    <!-- table区域-begin -->
    <div>
      <vxe-grid
        style="width: 100%;"
        :height="curHeight"
        size="mini"
        align="center"
        highlight-hover-row
        stripe
        row-key
        row-id="selectedRowKeys"
        column-min-width="150"
        id="id"
        keep-source
        :loading="loading"
        border
        resizable
        auto-resize
        showOverflow
        showHeaderOverflow
        :pager-config="tablePage"
        ref="xGrid"
        :row-config="{ useKey: true,keyField: 'id',isCurrent:true,isHover:true}"
        :checkbox-config="{
          checkRowKeys:selectedRowKeys,
          trigger: 'row',
          highlight: true,
          reserve: true}"
        @sort-change="sortChange"
        @checkbox-change="checkboxChangeEvent"
        @checkbox-all="checkboxChangeEvent"
        :data="dataSource"
        :columns="columns"
        @page-change="handlePageChange"
      >
        <template v-slot:top>
          <div class="table-operator">
            <!-- 高级查询区域 -->
            <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
<!--            <a-dropdown v-if="selectedRowKeys.length > 0">
              <a-menu slot="overlay">
                <a-menu-item key="1" @click="batchDel">
                  <a-icon type="delete"/>
                  删除
                </a-menu-item>
              </a-menu>
              <a-button type="primary" icon="down">批量操作</a-button>
            </a-dropdown>-->
          </div>
        </template>
        <template v-slot:empty>
          <a-empty/>
        </template>
      </vxe-grid>
    </div>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { HYListMixin } from '@/mixins/HYListMixin'

  export default {
    name: 'WmsInventoryList',
    mixins:[HYListMixin, mixinDevice],
    components: {
    },
    data () {
      return {
        description: '库存表管理页面',
        /* 排序参数 */
        isorter: {
          column: 'inv.createTime',
          order: 'desc',
        },
        // 表头
        columns: [
          {type: "seq", width: 50, align: "center"},//
          { title : '库位编码', align : "center", field : 'locationCode' },
          { title : '库位类型', align : "center", field : 'locationType_dictText' },
          { title : '物料编码', align : "center", field : 'itemCode' },
          { title : '物料名称', align : "center", field : 'itemName' },
          { title : '包装单位', align : "center", field : 'baseUnit_dictText' },
          { title : '库存数量', align : "center", field : 'invQty' },
          { title : '托盘号', align : "center", field : 'palletNo' },
          { title : '箱号', align : "center", field : 'boxNo' },
          { title : '收货日期', align : "center", field : 'lot01' },
          { title : '销售单', align : "center", field : 'lot02' },
          { title : '供应商代码', align : "center", field : 'lot03' },
          { title : 'ERP代码', align : "center", field : 'lot04' },
          { title : '等级', align : "center", field : 'lot05' },
          { title : '档次', align : "center", field : 'lot06' },
          { title : 'SN号', align : "center", field : 'lot07' },
        ],
        url: {
          list: "/wms/wmsInventory/list",
          delete: "/wms/wmsInventory/delete",
          deleteBatch: "/wms/wmsInventory/deleteBatch",
          exportXlsUrl: "/wms/wmsInventory/exportXls",
          importExcelUrl: "wms/wmsInventory/importExcel",
        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
      this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'locationId',text:'库位',dictCode:''})
        fieldList.push({type:'string',value:'itemId',text:'物料',dictCode:''})
        fieldList.push({type:'string',value:'palletNo',text:'托盘号',dictCode:''})
        fieldList.push({type:'string',value:'boxNo',text:'箱号',dictCode:''})
        fieldList.push({type:'datetime',value:'lot01',text:'收货日期'})
        fieldList.push({type:'string',value:'lot02',text:'销售单',dictCode:''})
        fieldList.push({type:'string',value:'lot03',text:'供应商代码',dictCode:''})
        fieldList.push({type:'string',value:'lot04',text:'ERP代码',dictCode:''})
        fieldList.push({type:'string',value:'lot05',text:'等级',dictCode:''})
        fieldList.push({type:'string',value:'lot06',text:'档次',dictCode:''})
        fieldList.push({type:'string',value:'lot07',text:'SN号',dictCode:''})
        fieldList.push({type:'double',value:'invQty',text:'库存数量',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
